<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;
use think\model\Pivot;

/**
 * @mixin \think\Model
 */
class SampleProjectTargetPivot extends Pivot
{
    //
    //
    protected $name = 'sample_target';

    /**
     * @param $model
     * @param $id
     * @User: 刘海龙
     * @Date: 2021/7/26
     * @Time: 16:32
     * 中间件
     */
    public static function sampleProjectTargetSave($model, $id)
    {
        $model->targets()->detach();
        $model->targets()->attach($id);
    }
}
